home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 72 / maccd 72.iso / online / NetFinder 2.1.2 ƒ / NetFinder Script Components / Modules / Module Doco / Inside Perl Module.txt < prev   
Encoding:
Text File  |  2000-02-22  |  5.0 KB  |  177 lines  |  [TEXT/R*ch]

  1. (c) 2000 Peter Li, All Rights Reserved.
  2. =======================================
  3.  
  4.  
  5. This module provides some routines that mimic Perl routines.
  6. They may differ slightly from their Perl implementation, but their general
  7. functionality should be the same. For more info on Perl go to:
  8. <http://www.perl.org/> or <http://www.perl.com/>
  9.  
  10.  
  11. Standard Lib Routines
  12. =====================
  13.  
  14. LoadModuleConstants();
  15.  
  16. Description: Loads constants used by Perl Module to make scripts
  17.              more readable.
  18. Parameters:  none
  19. Returns:     null
  20.  
  21. -----------------------------
  22.  
  23. GetModuleVersion();
  24.  
  25. Description: Returns the version of this module.
  26. Parameters:  none
  27. Returns:     null
  28.  
  29.  
  30.  
  31. Perl Like Routines
  32. ==================
  33.  
  34. chomp(string* ioStr);
  35.  
  36. Description: chops off all trailing '\r' and '\n'.
  37. Parameters:  address of a string to be chomped.
  38. Returns:     null
  39.  
  40. Example:     string str = "abc\r\n";
  41.              Perl.chomp(&str);
  42.              /* str now = "abc" */
  43.  
  44. -----------------------------
  45.  
  46. chop(string* ioStr);
  47.  
  48. Description: chops off trailing '\r' or '\n'. ie ONLY one.
  49. Parameters:  address of a string to be chomped.
  50. Returns:     null
  51.  
  52. Example:     string str = "abc\n";
  53.              Perl.chop(&str);
  54.              /* str now = "abc" */
  55.  
  56. -----------------------------
  57.  
  58. int = hex(string inHexStr);
  59.  
  60. Description: converts a hex string into a number. eg "0x0A" -> 10
  61. Parameters:  inHexStr - hex number represented as a string.
  62. Returns:     hex number converted to a number.
  63.  
  64. Example:     string str = "0x0A";
  65.              int num = Perl.hex(str);
  66.              /* num = 10 */
  67.  
  68. -----------------------------
  69.  
  70. int = index(string inStr, string inSubStr [, int inFromPos]);
  71.  
  72. Description: Finds the position of a sub-string in another string.
  73.              Looks for inSubStr in inStr optionally starting at inFromPos
  74.              or from start of inStr if inFromPos is not provided.
  75. Parameters:  inStr - string to search for the sub-string.
  76.              inSubStr - sub-string to search for.
  77.              inFromPos - optional field to specify where to start looking
  78.                    for the sub-string inside the main string. Defaults
  79.                    to zero, ie the start of inStr.
  80. Returns:     returns position of sub-string or -1 if not found.
  81.  
  82. Example:     int pos = Perl.index("abcd", "b");
  83.              /* pos = 1 */
  84.  
  85. -----------------------------
  86.  
  87. string = join(string inSep [,string inData]+);
  88.  
  89. Description: joins the parameters passed in together with a seperator.
  90. Parameters:  inSep - the string to be used as the seperator.
  91.              inData - one of a possible list of strings (or numbers).
  92. Returns:     a string with all the parameters concatenated.
  93.  
  94. NOTE:        numbers represent the ASCII value, they are not converted to 
  95.              strings.
  96.  
  97. Example:     string str = Perl.join("::", "a", "b", 10, "c");
  98.              /* str = "a::b::\n::c" */
  99.  
  100. -----------------------------
  101.  
  102. lc(string* ioStr);
  103.  
  104. Description: converts the string passed in to lowercase.
  105. Parameters:  ioStr - pointer to string to convert to lowercase.
  106. Returns:     null
  107.  
  108. Example:     string str = "ABC";
  109.              Perl.lc(&str);
  110.              /* str now = "abc" */
  111.  
  112. -----------------------------
  113.  
  114. lcfirst(string* ioStr);
  115.  
  116. Description: converts the first character of string passed in to lowercase.
  117. Parameters:  ioStr - pointer to string to convert to lowercase.
  118. Returns:     null
  119.  
  120. Example:     string str = "The";
  121.              Perl.lcfirst(&str);
  122.              /* str now = "the" */
  123.  
  124. -----------------------------
  125.  
  126. int = oct(string inOctNumStr);
  127.  
  128. Description: converts an octal number string into a number.
  129. Parameters:  inOctNumStr - octal number as a string.
  130. Returns:     octal number as an integer.
  131.  
  132. Example:     string str = "8";
  133.              int num = Perl.oct(str);
  134.              /* num now = 8 */
  135.  
  136. -----------------------------
  137.  
  138. int = rindex(string inStr, string inSubStr [, int inFromPos]);
  139.  
  140. Description: same as index, but looks in reverse order. ie from back of the 
  141.              string to the front of the string.
  142. Parameters:  inStr - string to search for the sub-string.
  143.              inSubStr - sub-string to search for.
  144.              inFromPos - optional field to specify where to start looking
  145.                    for the sub-string inside the main string. Defaults
  146.                    to zero, ie the start of inStr.
  147. Returns:     returns position of sub-string or -1 if not found.
  148.  
  149. Example:     int pos = Perl.rindex("abca", "a");
  150.              /* pos = 3 */
  151.  
  152. -----------------------------
  153.  
  154. uc(string* ioStr);
  155.  
  156. Description: converts the string passed in to uppercase.
  157. Parameters:  ioStr - pointer to string to convert to uppercase.
  158. Returns:     null
  159.  
  160. Example:     string str = "the";
  161.              Perl.uc(&str);
  162.              /* str now = "THE" */
  163.  
  164. -----------------------------
  165.  
  166. ucfirst(string* ioStr);
  167.  
  168. Description: converts the first character of string passed in to uppercase.
  169. Parameters:  ioStr - pointer to string to convert to uppercase.
  170. Returns:     null
  171.  
  172. Example:     string str = "the";
  173.              Perl.ucfirst(&str);
  174.              /* str now = "The" */
  175.  
  176. -----------------------------
  177.